| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Static Public Member Functions | List of all members
nkImages::PngEncoder Class Referencefinal

Offers capabilities to decode the PNG format. More...

## Static Public Member Functions
static bool | canDecode (nkMemory::BufferView< unsigned char > data)
static Image | decode (nkMemory::BufferView< unsigned char > data, const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor())

## Detailed Description

Offers capabilities to decode the PNG format.

Note that for now, only decoding is supported.

## Member Function Documentation

## ◆ canDecode()

static bool nkImages::PngEncoder::canDecode | ( | nkMemory::BufferView< unsigned char > | data | ) |
| static

Checks whether a binary buffer can be decoded by this encoder. This checks the buffer header for the magic bytes.

Parameters

  data | The binary data which need to be checked.

Returns
  Whether the binary buffer can be decoded (true) or not (false).

## ◆ decode()

static Image nkImages::PngEncoder::decode | ( | nkMemory::BufferView< unsigned char > | data,
|  | const AlignmentDescriptor & | alignmentDescriptor = `AlignmentDescriptor()`
| ) |  |
| static

Decodes a binary buffer into its image representation.

Currently supported features are :

- Grayscale with or without alpha, with a bit depth of 8.
- Palette with a bit depth of 4.
- RGB and RGBA with a bit depth of 8.

Parameters

  data | The binary buffer to decode.
  alignmentDescriptor | If decoded image's data needs to fit some alignment requirements, they can be specified through this parameter.

Returns
  The decoded image, if data could be decoded.

Remarks
  If something goes wrong, the error will be logged and an empty image will be returned.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsImages/Png/PngEncoder.h